package com.xtoad.ecms.baseinfo.model;

import com.xtoad.ecms.baseinfo.enums.ResourceType;
import com.xtoad.ecms.common.web.base.BaseModel;
import org.hibernate.annotations.Table;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

/**
 * 资源
 *
 * @author xtoad
 * @date 2021/1/13
 */
@Entity
@Table(appliesTo = "resource", comment = "资源表")
public class Resource extends BaseModel {

    /**
     * 资源类型
     */
    @Column(nullable = false, columnDefinition = "varchar(10) comment '资源类型'")
    @Enumerated(EnumType.STRING)
    private ResourceType type;

    /**
     * 标题
     */
    @Column(nullable = false, columnDefinition = "varchar(50) comment '标题'")
    private String title;

    /**
     * url
     */
    @Column(nullable = true, columnDefinition = "varchar(250) comment 'url'")
    private String url;

    /**
     * 获取 资源类型
     */
    public ResourceType getType() {
        return this.type;
    }

    /**
     * 设置 资源类型
     */
    public void setType(ResourceType type) {
        this.type = type;
    }

    /**
     * 获取 标题
     */
    public String getTitle() {
        return this.title;
    }

    /**
     * 设置 标题
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * 获取 url
     */
    public String getUrl() {
        return this.url;
    }

    /**
     * 设置 url
     */
    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString() {
        return "Resource{" +
                "type=" + type +
                ", title='" + title + '\'' +
                ", url='" + url + '\'' +
                "} " + super.toString();
    }
}
